﻿using System.Windows.Forms;
using AuthoritExtensibility;
using HelloWorld.Properties;

namespace HelloWorld
{
    class PluginManager : IPlugin
    {
        ToolbarAddArgs mainFormArgs;
        private AitApplicationProxy myProxy;

        public PluginManager(AitApplicationProxy proxy)
        {
            myProxy = proxy;
            mainFormArgs = new ToolbarAddArgs();
            mainFormArgs.IconImage = Resources.hw;
            mainFormArgs.PluginName = "HelloWorld";
            mainFormArgs.TargetForm = TargetForm.MainForm;
            mainFormArgs.TargetGroupName = "Web";
            mainFormArgs.TargetButtonName = "Hello World";
            mainFormArgs.Tooltip = "Hello World";
            mainFormArgs.OnClick = clickHandler;
            proxy.AddPluginToToolbar(mainFormArgs);
        }

        private void clickHandler(object sender, AuthoritEventArgs e)
        {
            HelloWorldForm form = new HelloWorldForm(e);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.MaximizeBox = false;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.ShowDialog();
        }
        
    }
}
